import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)


const Home = () => import("./pages/home")
const Search = () => import("./pages/search")
const Login = () => import("./pages/login")
const Register = () => import("./pages/register")
const SettingShop = () => import("./pages/settingShop")
const OpenShop = () => import("./pages/openShop")

const Design = () => import("./pages/design");
const DesignAdd = () => import("./pages/designAdd");
const DesignEdit = () => import("./pages/designEdit");
const DesignPublish = () => import("./pages/designPublish");
const Product = () => import("./pages/product");
const Upload = () => import("./pages/upload");
const Shopcart = () => import("./pages/shopcart");
const Order = () => import("./pages/order");
const OrderDetail = () => import("./pages/orderDetail");
const MySelf = () => import("./pages/myself");
const MyShop = () => import("./pages/myShop");

export default new VueRouter({
    routes: [
        {path: '/', component: Home},
        {path: '/search', component: Search},
        {path: '/login', component: Login},
        {path: '/register', component: Register},
        {path: '/setting-shop', component: SettingShop},
        {path: '/open-shop', component: OpenShop},
        {path: '/product/:id', component: Product},
        {path: '/upload', component: Upload},
        {path: '/shopcart', component: Shopcart},
        {path: '/order', component: Order},
        {path: '/order/:id', component: OrderDetail},
        {path: '/myself', component: MySelf},
        {path: '/shop/:name', component: MyShop},

        {
            path: '/design',
            component: Design,
            children: [
                {path: '/design/upload', component: DesignAdd},
                {path: '/design/edit', component: DesignEdit},
                {path: '/design/publish', component: DesignPublish},

            ]
        },
    ]
})